home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / MSG Graphic Effects 1.0 Source / Corner circle.c < prev    next >
Text File  |  1993-08-23  |  2KB  |  59 lines

  1. /*******************************************************************************
  2.  * Copyright © 1992-1993 Mark Pilgrim                                          *
  3.  *                                                                             *
  4.  * This file is provided as is, and may be freely distributed unaltered.  This *
  5.  * message must accompany any copy of this file.  This file may be used or     *
  6.  * modified for use for a non-commercial product provided that appropriate     *
  7.  * credit is given to the author named above.                                  *
  8.  * Commercial use of this source code is prohibited.                           *
  9.  ******************************************************************************/
  10.  
  11. #include "msg misc.h"
  12. #include "msg timing.h"
  13.  
  14. #define    gap            8        /* difference between one radius and the next */
  15. #define CorrectTime 2
  16.  
  17. void CornerCircle(GrafPtr);
  18.  
  19. /* Make progressively larger circle regions, centered at the top-left corner
  20.    of the screen.  Quickdraw takes care of all the excess space off the screen
  21.    that you include in the region. */
  22.    
  23. void CornerCircle(GrafPtr sourceGrafPtr)
  24. {
  25.     Rect        theRect;
  26.     int            cx, cy;
  27.     RgnHandle    curregion;
  28.     Point        zeropoint;
  29.     
  30.     theRect.left=-gap;
  31.     theRect.right=gap;
  32.     theRect.top=-gap;
  33.     theRect.bottom=gap;
  34.     
  35.     curregion=NewRgn();
  36.     
  37.     zeropoint.v=MAIN_WINDOW_HEIGHT;
  38.     zeropoint.h=MAIN_WINDOW_WIDTH;
  39.     
  40.     do
  41.     {
  42.         StartTiming();
  43.         SetEmptyRgn(curregion);
  44.         OpenRgn();
  45.             FrameOval(&theRect);
  46.         CloseRgn(curregion);
  47.         CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
  48.                 &theRect, &theRect, 0, curregion);
  49.         theRect.left-=gap;
  50.         theRect.right+=gap;
  51.         theRect.top-=gap;
  52.         theRect.bottom+=gap;
  53.         TimeCorrection(CorrectTime);
  54.     }
  55.     while (!(PtInRgn(zeropoint,curregion)));
  56.     
  57.     DisposeRgn(curregion);
  58. }
  59.